home *** CD-ROM | disk | FTP | other *** search
/ Ian & Stuart's Australian Mac 1993 September / September 93.iso / Archives / Applications / Calculators / π Folder / πCALC.c < prev   
Encoding:
C/C++ Source or Header  |  1993-05-03  |  836 b   |  42 lines  |  [TEXT/KAHL]

  1. /*    πCALC 1.0b
  2. *    -Bloom!- Software Group
  3. *
  4. *    πCALC was written Robert Rose
  5. *
  6. *    Requires ANSI and THINK C 4.x or higher
  7. */
  8.  
  9. #include <stdio.h>
  10. #include <stdlib.h>
  11. #include <console.h>
  12.  
  13. main()
  14. {
  15.     long double        pi, x, pi2, x2, i;
  16.     
  17.     console_options.title = "\pπCALC 1.0";
  18.     cshow(stdout);
  19.     printf("πCALC by Robert Rose\n");
  20.     printf("-Bloom!- Software Group\n");
  21.     printf("\n");
  22.     printf("Special thanks to Wayne Jackson for the π equation!\n");
  23.     printf("***PRESS COMMAND-PERIOD OR ESCAPE TO QUIT***\n");
  24.     printf("\n");
  25.     
  26.     x = 3;
  27.     pi2 = 4;
  28.     i = 0;
  29.     while ( ++i > (-1)) {           /* All this does is make it loop */
  30.         pi = pi2 - (4 / x);
  31.         printf("%Lg: π = %Lg\n", i, pi);  /* Use %Lg for C to decide */
  32.         pi2 = pi;
  33.         x2 = x;
  34.         x = x2 + 2;
  35.         i++;
  36.         pi = pi2 + (4 / x);
  37.         printf("%Lg: π = %Lg\n", i, pi);
  38.         pi2 = pi;
  39.         x2 = x;
  40.         x = x2 + 2;
  41.     }
  42. }